<%@page pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ファイル管理</title>
<link type="text/css" href="/css/admin/default.css" rel="stylesheet" />
<link type="text/css" href="/css/admin/main.css" rel="stylesheet" />
<link type="text/css" href="/css/admin/menu.css" rel="stylesheet" />
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript" src="/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="/js/lightbox.js"></script>
<link rel="stylesheet" href="/css/lightbox.css" type="text/css" media="screen" />
</head>
<body>
	<form action="${f:url('uploadForApplication')}" method="post" enctype="multipart/form-data">
		<input type="file" name="formFile" /><br />
		<input type="submit" value="Upload"/>
	</form>

	<br /><br />
	<table>
		<c:if test="${fn:length(dataList) > 0}">
		<thead>
			<tr><th>FileName</th><th>Bytes</th></tr>
		</thead>
		</c:if>
		<tbody>
		<c:forEach var="e" items="${dataList}">
			<tr>
				<td><a href="/files?key=${e.keyString}&w=500&h=300" rel="lightbox" title="テスト"><img src="/files?key=${e.keyString}&w=200&h=300" /></a></td>
				<td style="padding:5 20 5 5;">${e.keyString}</td>
				<td style="padding:5 20 5 5;">${e.length}</td>
				<c:set var="downloadUrl" value="download?key=${e.keyString}"/>
				<c:set var="showUrl" value="show?key=${e.keyString}"/>
				<c:set var="deleteUrl" value="delete?key=${e.keyString}"/>
				<td style="padding:5 20 5 5;"><a href="${f:url(downloadUrl)}">Download</a></td>
				<td style="padding:5 20 5 5;"><a href="${f:url(showUrl)}">Show</a></td>
				<td style="padding:5 20 5 5;"><a href="${f:url(deleteUrl)}" onclick="return confirm('delete OK?')">Delete</a></td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</body>
</html>